function disableSelection(target){if(typeof target.onselectstart!="undefined")
target.onselectstart=function(){return false}
else if(typeof target.style.MozUserSelect!="undefined")
target.style.MozUserSelect="none"
else
target.onmousedown=function(){return false}}
function animate(){$('div#category-wrapper').css({'width':'0','opacity':'0'}).delay(500).animate({width:'178',opacity:1},'slow');$('div#contents div.tabs > a.adtype').delay(1500).fadeIn();return false;}
function openCategories(){scrollTo(0,0);$('div#category-switcher div#category-wrapper ul').stop().delay(250).slideDown();$('div#category-switcher').addClass("pushed");return false;}
function openPanel(panelId){if($('a#search-pin').hasClass("unpinned"))
scrollTo(0,0);$("div#search-contents ul").idTabs(panelId);return false;}
function displayTour(){$('body').css("overflow","hidden");$('div#tour div#overlay').show();disableSelection(document.getElementById('overlay'));$('div#tour div.step1').fadeIn('slow').animate({right:'246px'},'slow');openCategories();return false;}
function displayQuickAd(){$('body').css("overflow","hidden");$('div#quickad div#quickad-overlay').fadeIn(1000);$('div#quickad div#quickad-container').fadeIn("fast");disableSelection(document.getElementById('quickad-overlay'));return false;}
function setUIpreference(){if($.cookie('searchBarPinned')==0){var scroller=new StickyScroller("#search",{start:146,end:146,interval:300,range:59,margin:0});$('a#search-pin').addClass("unpinned");return false;}
else{var scroller=new StickyScroller("#search",{start:146,end:3000,interval:300,range:59,margin:0});}}
function videoPlay(){flowplayer("player","Videos/flowplayer-3.2.7.swf",{clip:{autoPlay:true,autoBuffering:false,},plugins:{controls:{mute:false,volume:false}},play:{label:null,replayLabel:"پخش مجدد"}});}
$(document).ready(function(){$('div.contents-dualcolumn.reviews h3').click(function(){$('div.contents-dualcolumn.reviews ul').slideUp("slow");$(this).siblings("h3").removeClass("active");if($(this).hasClass("active")){$(this).removeClass("active");}
else{$(this).addClass("active");$(this).next("ul").slideDown();}});$('.externallink').click(function(){window.open(this.href);return false;});$('#content-moreinfo h2').toggle(function(){$('#moreinfo-contents').slideUp('slow');return false;},function(){$('#moreinfo-contents').slideDown('normal');return false;});$('#content-contact h2').toggle(function(){$('#contact-contents').slideDown('normal');$(this).addClass("opened");return false;},function(){$('#contact-contents').slideUp('slow');$(this).removeClass("opened");return false;});$('ul.comments li.trigger').toggle(function(){$(this).parent().parent().next("div.response-form").slideDown();$(this).addClass("opened");return false;},function(){$(this).parent().parent().next("div.response-form").slideUp('slow');$(this).removeClass("opened");return false;});$('ul.comments > li').hoverIntent(function(){$(this).find("div.footer").slideDown();return false;},function(){$(this).find("div.footer").slideUp('slow');return false;});$('a[href*=#]').click(function(){var $target=$(this.hash);$target=$target.length&&$target||$('[name='+ this.hash.slice(1)+']');if($target.length){var targetOffset=$target.offset().top;$('html,body').animate({scrollTop:targetOffset},1000);return false;}});$('.pager-print').click(function(){parent.print();return false;});$('.pager-back').click(function(){history.back();return false;});$('div#category-switcher').click(function(){if($('div#category-switcher div#category-wrapper ul').css("display")!="block"){$('div#category-switcher div#category-wrapper ul').slideDown('fast');$('div#category-switcher').addClass("pushed");}
else{$('div#category-switcher div#category-wrapper ul').slideUp('fast');$('div#category-switcher').removeClass("pushed");}});$('div#category-switcher').hover(function(){return false;},function(){$('div#category-switcher div#category-wrapper ul').fadeOut();$('div#category-switcher').removeClass("pushed");return false;});$('a#search-pin').click(function(){if($(this).hasClass("unpinned")){var scroller=new StickyScroller("#search",{start:146,end:3000,interval:300,range:59,margin:0});$(this).removeClass("unpinned");$.cookie('searchBarPinned','1',{expires:365,path:'/'});return false;}
else{var scroller=new StickyScroller("#search",{start:146,end:146,interval:300,range:59,margin:0});$(this).addClass("unpinned");$.cookie('searchBarPinned','0',{expires:365,path:'/'});return false;}});$(".tabs > ul").idTabs(function(id,list,set){$("a",set).removeClass("selected").filter("[href='"+ id+"']",set).addClass("selected");for(i in list)
$(list[i]).hide();$(id).fadeIn();return false;});$("div#search-contents ul").idTabs("none",function(id,list,set){$("li",set).removeClass("selected");$("a",set).removeClass("selected").filter("[href='"+ id+"']",set).addClass("selected").parent().addClass("selected");for(i in list)
$(list[i]).fadeOut('fast');$(id).slideDown();return false;});$(".tabs-about > ul").idTabs(function(id,list,set){$("a",set).removeClass("selected").filter("[href='"+ id+"']",set).addClass("selected");for(i in list)
$(list[i]).hide();$(id).fadeIn();return false;});$("div.search-panel-wrapper ul#parent a.parent").click(function(){$("div.search-panel-wrapper a.return").fadeIn();$("div.search-panel-wrapper ul#parent").slideUp('fast');$("div.search-panel-wrapper ul"+ $(this).attr('href')).slideDown('slow');return false;});$("div.search-panel-wrapper a.return").click(function(){$("div.search-panel-wrapper a.return").fadeOut();$("div.search-panel-wrapper div#levels ul").slideUp('fast');$("div.search-panel-wrapper ul#parent").slideDown('slow');return false;});$("div.search-panel-wrapper a.close").click(function(){$(this).parent().parent().slideUp();$("li","div#search-contents ul").removeClass("selected");$("a","div#search-contents ul").removeClass("selected");$("div","div#search").removeClass("flag");return false;});$("div#search-contents ul li a").click(function(){target="div.search-panel"+ $(this).attr("href");if($(target).css("display")!="none"&&$(target).attr("class")=="search-panel flag"){$(target).slideUp();$("li","div#search-contents ul").removeClass("selected");$("a","div#search-contents ul").removeClass("selected");$(target).removeClass("flag");}
else{$("div","div#search").removeClass("flag");$(target).addClass("flag");}
return false;});$("div.search-panel div.form div.radiocheckbox label.radio-rent").click(function(){$("div.search-panel div.form label.rent").fadeIn();$("div.search-panel div.form label.bond").fadeOut();});$("div.search-panel div.form div.radiocheckbox label.radio-bond").click(function(){$("div.search-panel div.form label.rent").fadeOut();$("div.search-panel div.form label.bond").fadeIn();});$("div.search-panel div.form div.radiocheckbox label.radio-both").click(function(){$("div.search-panel div.form label.rent").fadeIn();$("div.search-panel div.form label.bond").fadeIn();});$('a#userpanel-trigger').click(function(){if($('div#userpanel-contents').css("display")!="block"){$('div#userpanel').addClass("opened");$('div#userpanel-contents').slideDown('fast');$('a#userpanel-trigger').addClass("opened");return false;}
else{$('div#userpanel-contents').slideUp();$('a#userpanel-trigger').removeClass("opened");$('div#userpanel').removeClass("opened");return false;}});$('div#contents ul.pager li.pager-sortby > a').click(function(){if($('div#contents ul.pager li.pager-sortby ul').css("display")!="block"){$('div#contents ul.pager li.pager-sortby ul').slideDown('fast');$('div#contents ul.pager li.pager-sortby > a').addClass("selected");}
else{$('div#contents ul.pager li.pager-sortby ul').slideUp('fast');$('div#contents ul.pager li.pager-sortby > a').removeClass("selected");}
return false;});$('div#contents ul.pager li.pager-sortby').hover(function(){},function(){$('div#contents ul.pager li.pager-sortby ul').fadeOut();$('div#contents ul.pager li.pager-sortby > a').removeClass("selected");return false;});$('input.currency').keyup(function(){var separator=",";var curr=this.value.replace(new RegExp(separator,"g"),"");var regexp=new RegExp("\\B(\\d{3})("+ separator+"|$)");do{curr=curr.replace(regexp,separator+"$1");}while(curr.search(regexp)>=0)
this.value=curr;});$("#slides").PikaChoose({showCaption:false,autoPlay:true,transition:[5],showTooltips:false,hoverPause:true});$('div#slider div#slider-wrapper').css("text-indent","0px");jQuery('ul#textslide').jcarousel({rtl:true,scroll:1,auto:5,wrap:'both'});$('#filters ul.exposable li.exposable-trigger').click(function(){$(this).parent().addClass("exposed");return false;});$('ul.fullclick li').click(function(){window.location=$(this).find("a").attr("href");return false;});$("a.tour").click(function(){displayTour();return false;});$("div#tour div.step1 a.next").click(function(){$('div#tour div.step1').fadeOut('slow');$('div#tour div.step2').fadeIn('fast').animate({top:'215px'},'slow');return false;});$("div#tour div.step2 a.next").click(function(){$('div#tour div.step2').fadeOut('slow');$('div#tour div.step3').fadeIn('fast').animate({top:'63px'},'slow');return false;});$("div#tour div.step3 a.next").click(function(){$('div#tour div.step3').fadeOut('slow');$('div#tour div.step4').fadeIn('fast').animate({top:'250px'},'slow');return false;});$("div#tour a.close").click(function(){$('div#tour div').fadeOut('slow');$('div#tour div#overlay').hide();$('body').css("overflow","auto");return false;});$("a.quickad").click(function(){displayQuickAd();return false;});$("div#quickad a.close, div#quickad div#quickad-overlay").click(function(){$('div#quickad div#quickad-container').fadeOut();$('div#quickad div#quickad-overlay').fadeOut(1000);$('body').css("overflow","auto");return false;});$("*.categoryswitcher").click(function(){openCategories();return false;});$("*.searchbox").click(function(){$("input#search-textbox").focus();return false;});$('div.contents-gridview > ul > li').hoverIntent(function(){$(this).append('<span class=\"pointer\"></span>');$(this).find("span.pointer").fadeIn();$(this).find("p").fadeIn();$(this).find("ul").slideDown('slow');return false;},function(){$(this).find("span.pointer").fadeOut('fast').remove();$(this).find("p").fadeOut('fast');$(this).find("ul").slideUp('fast');return false;});$("div#header ul#toplinks a[Title], div#header h1 a[Title], div#header div#userpanel a#userpanel-trigger[Title]").tipsy({fade:true,gravity:'n',offset:5,opacity:0.75});$("div#search-contents a[Title], div#search-contents input[Title]").tipsy({fade:true,gravity:'n',offset:15,opacity:0.75});$("div#category-wrapper a[Title], div#category-switcher[Title]").tipsy({fade:true,gravity:'w',offset:5,opacity:1});$('div.form  label span[Title], a.tooltip[title], a.howto[title]').tipsy({fade:true,gravity:'sw',opacity:0.75});$('h2 a[Title], div#contents table input[title], a.adtype[title], div#wrapper > div.jcarousel-container li.jcarousel-item a[title]').tipsy({fade:true,gravity:'s',offset:5,opacity:0.75});setUIpreference();animate();checkFirstVisit();});